const path = require('path')

const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const AddHTMLWebpackPlugin = require('./plugins/add-html-webpack-plugin')

module.exports = {
  mode: 'development',
  entry: {
    main: './src/index.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: [{
          loader: path.resolve(__dirname, './loaders/replace-name-loader.js'),
          options: { name: 'webpack loader' }
        }]
      }
    ]
  },
  plugins: [
    new CleanWebpackPlugin(),
    new AddHTMLWebpackPlugin({
      name: 'index.html'
    })
  ]
}